package hdgeom.hEdge;

import java.util.Comparator;

public class HEdgeAngleComparator implements Comparator {

	public int compare(Object arg0, Object arg1) {
		HEdge h1 = (HEdge) arg0;
		HEdge h2 = (HEdge) arg1;
		double angle1 = h1.getAngle();
		double angle2 = h2.getAngle();
		if (angle1 > angle2)
			return 1;
		if (angle1 < angle2)
			return -1;
		if (h1.getDest().z > h1.getDest().z)
			return 1;
		if (h1.getDest().z < h1.getDest().z)
			return -1;
		double l1 = h1.getLengthSqr();
		double l2 = h2.getLengthSqr();
		if (l1 > l2)
			return 1;
		if (l1 < l2)
			return -1;

		// TODO Auto-generated method stub
		return 0;
	}

}
